var remoting = require('strong-remoting');
var SharedClass = remoting.SharedClass
var remotes = remoting.create();

function User() {

}
User.greet = function (fn) {
  console.log(arguments)
  fn(null, 'hello, world!');
}

// create a shared class to allow strong-remoting to map
// http requests to method invocations on your class
var userSharedClass = new SharedClass('user', User);

userSharedClass.defineMethod('greet', {
  isStatic: true, // not an instance method
  returns: [{
    arg: 'msg',
    type: 'string' // define the type of the callback arguments
  }]
});
// let route = require("loopback")().loopback.Router();
// route.use(bodyParser.urlencoded({ extended: false }))
// route.use(remotes.handler('rest'))
var express = require('express')
let app = express()
let r = express.Router()
r.use(function (req, res, next) {
  remotes.handler('rest')(req, res)
})
app.use(r)

app.listen(3003);